package org.example.jufp.controller;

import org.example.jufp.modle.Info;
import org.example.jufp.modle.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ufp")
public class TestController {
    //返回基本类型
    @RequestMapping("int")
    public int returnInt() {
        int ret = 10;
        return ret;
    }

    //返回包装类型
    @RequestMapping("Integer")
    public Integer returnInteger() {
        Integer ret = 127;
        return ret;
    }

    //返回对象
    @RequestMapping("Info")
    public Info returnInfo() {
        Info ret = new Info();
        ret.setName("牛牛");
        ret.setAge(19);
        ret.setId(10086);
        return ret;
    }

    //返回String
    @RequestMapping("String1")
    public Result<?> returnString1() {
        String ret = "返回了一个String";
        return Result.retBody(ret, 200);
    }

    @RequestMapping("String2")
    public String returnString2() {
        String ret = "返回了一个String";
        return ret;
    }
}
